package com.majun.web;

import com.majun.service.SimpleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 测试的controller，事务传播直接测试
 * @author majun
 * @date 2025/04/16
 */
@RestController
@RequestMapping("/api")
@Slf4j
public class ApiController {


    @Autowired
    private SimpleService simpleService;


    @GetMapping("/addAll")
    public void addAll(){
        simpleService.addAll();
    }

    /**
     * @Description: 使用内部方法调用导致事务失效-矫正补偿
     * @Date: 2022/11/716:26
     */
    @GetMapping("addInnerMethodOK")
    public void addInnerMethodOK() {
        simpleService.addInnerMethodOK();
    }

    /**
     * @Description: 使用内部方法调用导致事务失效-矫正补偿
     * @Date: 2022/11/716:26
     */
    @GetMapping("addPublicMethod")
    public void addPublicMethod() {
        simpleService.addPublicMethod();
    }

    /**
     * @Description: 使用内部方法调用导致事务失效-矫正补偿
     * @Date: 2022/11/716:26
     */
    @GetMapping("addNewThreadOK")
    public void addNewThreadOK() {
        simpleService.addNewThreadOK();
    }


}
